﻿@using System.Web.Mvc;
@using System.Security.Cryptography;

@*=====================================================
******************Layout related Methods*********************
======================================================*@

@helper Script(string scriptName, UrlHelper url)
    {
    <script src="@url.Content("~/Scripts/" + scriptName)" type="text/javascript" ></script>
}

@helper Image(string imageName, string altLabel, UrlHelper url)
    {
    <img alt="@altLabel" src="@url.Content("~/Images/" + imageName)" /> 
}
@helper Image(string imageName, string altLabel, UrlHelper url, string classes)
    {
    <img alt="@altLabel" src="@url.Content("~/Images/" + imageName)" class="@classes" /> 
}

@helper LoadingCircle(UrlHelper url)
    {
    <img alt="Loading..." src="@url.Content("~/Images/ajax-loader-circle.gif")"  /> 
}
@helper LoadingBar(UrlHelper url)
    {
    <img alt="Loading..." src="@url.Content("~/Images/ajax-loader-bar.gif")"  /> 
}

@helper WideTextInput()
    {
<style type="text/css">
    input[type="text"],
    input[type="password"],
    textarea,
    select
    {
        width: 96%;
    }
</style>
}

@*=====================================================
******************Views Related Methods*********************
======================================================*@


@helper ActionIconButton(UrlHelper url, int id, string action, string title, string icon, bool delete = false)
    {
    string controller = url.RequestContext.RouteData.Values["controller"].ToString();
    string action_url = "";

    if (id > 0) { action_url = @url.Action(@action, @controller, new { id = @id }); }
    else { action_url = @url.Action(@action, @controller); }

    //action += "/" + id.ToString();

    if (delete)
    {
        <a href="@action_url" onclick="return DeleteConfirmation()" title="@title" class="actionbutton"><span class="action-icon @icon"></span></a>
    }
    else
    {
        <a href="@action_url" title="@title" class="actionbutton"><span class="action-icon @icon"></span></a>
    }
    
}


@helper ActionIconDeleteButton(UrlHelper url, int id, string action, string title, string icon, string confirmtitle, string message)
    {
    string controller = url.RequestContext.RouteData.Values["controller"].ToString();
    string action_url = "";

    if (id > 0) { action_url = @url.Action(@action, @controller, new { id = @id }); }
    else { action_url = @url.Action(@action, @controller); }

            //action += "/" + id.ToString();

        <a href="@action_url" onclick="return DeleteConfirmation('@title','@message','@action_url')" title="@title" class="actionbutton" confirm-title="@confirmtitle" confirm-message="@message"><span class="action-icon @icon"></span></a>
    
}

